<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <h1 style="color: aqua;"> <%= title%> </h1>
  账号: <input type="text" class="user">
  密码:<input type="text" class="pwd">
  <button class="btn">提交</button>
  <script src="js/axios.js"></script>
  <script>

    const user = document.querySelector('.user')
    const pwd = document.querySelector('.pwd')
    const btn = document.querySelector('.btn')

    btn.onclick = function () {
      // 1. 前端请求接口 
      // 2. 传输参数
      axios.post('/api/register', {
        user: user.value.trim(),
        pwd: pwd.value.trim()
      }).then(res => {
        console.log(res, 'res')
      })
    }


  </script>
</body>

</html>